package controller

import (
	"app/internal/api/chat/entity"
	"app/internal/api/chat/service"
	"github.com/gin-gonic/gin"
)

var ChatController = &chatController{}

type chatController struct {
}

func (c chatController) Complete(ctx *gin.Context) {
	var req = new(entity.ChatRequest)
	//参数验证
	if err := ctx.ShouldBindJSON(&req); err != nil {
		//返回错误信息
		return
	}
	//调用 StreamComplete 服务
	err := service.NewChatAiService().StreamComplete(ctx, &entity.ChatStreamRequest{
		UserID:  ctx.GetInt("uid"),
		Request: req,
	})
	if err != nil {
		//返回错误信息
		return
	}
}
